<!--  -->
<template>
  <div>
    <navbar>
      <template v-slot:left class="left"><img src="~assets/img/common//back.svg" alt="" @click="backClick"></template>
      <template v-slot:center>
        <div class="title">
          <span v-for="(title,index) in titles" @click="itemClick(index)" :class="{active:currentIndex === index}">{{title}}</span>
        </div>
      </template>
    </navbar>
  </div>
</template>

<script>
import navbar from 'components/common/navbar/NavBar.vue'
export default {
  data () {
    return {
      titles:['商品','参数','评论','推荐'],
      currentIndex:0
    }
  },
  components:{
    navbar
  },
  methods:{
    backClick() {
      this.$router.back()
    },
    itemClick(index) {
      this.currentIndex = index;
      this.$emit('itemClick',index);
    }
  }
}
</script>

<style  scoped>
  .left img {
    width: 20px;
    margin-top: 12px;
  }
  .title{
    display: flex;
  }
  .title span {
    flex: 1;
    font-size: 13px;
  }
  .active{
    color: pink;
    /* color: var(--color-high-text); */
    /* color: greenyellow; */
  }
</style>
